# Locate SDL2IMAGE library
# This module defines
# SDL2IMAGE_LIBRARY, the name of the library to link against
# SDL2IMAGE_FOUND, if false, do not try to link to SDL2IMAGE
# SDL2IMAGE_INCLUDE_DIR, where to find SDL.h
#

SET(SDL2IMAGE_SEARCH_PATHS
	~/Library/Frameworks
	/Library/Frameworks
	/usr/local
	/usr
	/sw # Fink
	/opt/local # DarwinPorts
	/opt/csw # Blastwave
	/opt
	$ENV{SDL2IMAGEDIR}
)

FIND_PATH(SDL2IMAGE_INCLUDE_DIR SDL_image.h
	HINTS
	$ENV{SDL2IMAGEDIR}
	PATH_SUFFIXES include/SDL2 include
	PATHS ${SDL2IMAGE_SEARCH_PATHS}
)

FIND_LIBRARY(SDL2IMAGE_LIBRARY_TEMP
	NAMES SDL2_image
	HINTS
	$ENV{SDL2IMAGEDIR}
	$ENV{SDL2IMAGE_LIBRARY}
	PATH_SUFFIXES lib64 lib
	PATHS ${SDL2IMAGE_SEARCH_PATHS}
)

#INCLUDE(FindPackageHandleStandardArgs)

#FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2IMAGE REQUIRED_VARS SDL2IMAGE_LIBRARY SDL2IMAGE_INCLUDE_DIR)

IF (SDL2IMAGE_INCLUDE_DIR)
	SET( SDL2IMAGE_FOUND 1 CACHE STRING "Set to 1 if SDL2_image is found, 0 otherwise")
ELSE (SDL2IMAGE_INCLUDE_DIR)
	SET( SDL2IMAGE_FOUND 0 CACHE STRING "Set to 1 if SDL2_image is found, 0 otherwise")
ENDIF (SDL2IMAGE_INCLUDE_DIR)

MARK_AS_ADVANCED( SDL2IMAGE_FOUND )


